package cn.duckerkj.mergeJS;

public class MergeJs {
	/*public void mergeJS(String sourcedir,String mergeAfterPathFileName)
    {
        String dirPath = this.Server.MapPath(sourcedir); //"~/Scripts/cform/";
        if (Directory.Exists(dirPath))
        {
            //获得目录信息
            DirectoryInfo dir = new DirectoryInfo(dirPath);
            //获得目录文件列表
            FileInfo[] files = dir.GetFiles("*.*");
            if (files != null && files.Length > 0)
            {
                string path = this.Server.MapPath(mergeAfterPathFileName); //"~/Scripts/formloader.js";
                StreamWriter sw = new StreamWriter(path, true, Encoding.UTF8);   //追加方式
                //
                string fname = "";                   
                foreach (FileInfo fileInfo in files)
                {
                    fname = fileInfo.Name;
                    string js_path=dirPath+fname;
                    StreamReader sr=new StreamReader(js_path);                        
                    while(sr.EndOfStream==false)
                    {
                        sw.WriteLine(sr.ReadLine());
                    }
                    sr.Close();
                    sr.Dispose();
                    sr = null;
                }
                sw.Flush();
                sw.Close();
                sw.Dispose();                    
            }
            else
            {
                this.Response.Write("目录下没获取到文件，没执行生成操作!");
            }
        }
        else
        {
            this.Response.Write("目录不存在！请重新设置目录");
        }
    }*/
}
